#include<bits/stdc++.h>
using namespace std;

class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param str1 string字符串 输入字符串str1
     * @return int整型
     */
    int canBePalindromicString(string str1) {
        // write code here
        int len=str1.size();
        if(len==0){
            return 1;
        }
        int begin=0;
        int end=0;
        bool flag=false;
        for(int i=0;i<str1.size();++i){
            string temp="##";
            temp = str1.substr(0,i)+temp+str1.substr(i,len-i);
            // cout<<temp<<endl;
            begin=0,end=temp.size()-1;
            while(begin<end){
                if(temp[begin]!=temp[end]){
                    if(temp[begin]=='#' ||temp[end]=='#'){

                    }
                    else{
                        // cout<<begin<<endl;
                        break;
                    }
                }
                // cout<<begin<<endl;
                ++begin;
                --end;
            }
            if(begin>=end){
                return 1;
            }
        }
        string temp="##";
        temp = str1.substr(0,str1.size())+temp;
        // cout<<temp<<endl;
        begin=0,end=temp.size()-1;
        while(begin<end){
            if(temp[begin]!=temp[end]){
                if(temp[begin]=='#' ||temp[end]=='#'){

                }
                else{
                    // cout<<begin<<endl;
                    break;
                }
            }
            // cout<<begin<<endl;
            ++begin;
            --end;
        }
        if(begin>=end){
            return 1;
        }
        return 0;
    }
};
int main(int argc, char const *argv[])
{
    Solution s;
    string str="abcdefghasssssssssssssssssssdqweqweqadasdfasffffffdassasa";
    // string str2="abca";
    string str2=" ";
    int res = s.canBePalindromicString(str);
    cout<<res<<endl;
    res = s.canBePalindromicString(str2);
    cout<<res<<endl;
    return 0;
}
